<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/html/common/public_header_main.jsp"%>

<link rel="stylesheet" href="${ctx_static }/dep/assets/css/metro.css">
<link rel="stylesheet" href="${ctx_static }/home/sysconf/css/zhidu.css">

<div class="row">
    <div class="col-lg-12 col-sm-12 col-xs-12">
        <div class="row">
            <div class="col-lg-12 col-sm-12 col-xs-12">
                <div class="widget">
                    <div class="widget-header">
                        <div class="widget-buttons">
                            <a href="#" data-toggle="collapse">
                                <i class="fa fa-minus"></i>
                            </a>
                            <a href="#" data-toggle="dispose">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                        <!--Widget Buttons-->
                    </div>
                    <!--Widget Header-->
                    <div class="widget-body">
                        <div class="widget-main ">
                        
                        <div class="row row_padding form-horizontal">
	                        <div class="col-md-3 col-sm-3 col-xs-12">
	                            <div class="form-group">
	                                <label class="col-lg-2 col-md-3 col-sm-3 control-label no-padding-right">日期</label>
	                                <div class="col-lg-10 col-md-9 col-sm-9">
	                                    <div class="controls">
	                                        <div class="input-group date">
	                                            <input type="text" class="form-control"
	                                                   id="reservation">
	                                            <span class="input-group-addon"><i
	                                                    class="fa fa-calendar"></i></span>
	                                        </div>
	                                    </div>
	                                </div>
	                            </div>
	                        </div>
	
	                        <div class="col-md-6 col-sm-6 col-xs-12">
	                            <div class="form-group col-md-6 col-sm-4 no-margin-right">
	                                <input id="searchVal" type="text" class="form-control"
	                                       placeholder="部门/标题/发布人" onkeydown="search();">
	                            </div>
	                            <div class="form-group col-lg-3 col-md-4 col-sm-4 no-margin-right">
	                                <select class="form-control" id="enable">
	                                    <option value="">状态</option>
	                                    <option value="1">生效</option>
	                                    <option value="0">废除</option>
	                                </select>
	
	                            </div>
	                            <div class="form-group col-lg-3 col-md-3 col-sm-4">
	                                <a type="button" href="javascript:InitiateSimpleDataTable.init();"
	                                        class="btn btn-blue form-control search-btn">搜索
	                                </a>
	
	                            </div>
	                        </div>
	
	
	                        <div class="col-md-3 col-sm-3 col-xs-12 btn-group">
	                        <span class="btn btn-default pointer"
	                              title="View print view"><span>打印</span></span>
	                            <div class="btn-group">
	                                <button type="button" class="btn btn-default dropdown-toggle"
	                                        data-toggle="dropdown">
	                                    导出
	                                    <i class="fa fa-angle-up"></i>
	                                </button>
	                                <ul class="dropdown-menu" role="menu">
	                                    <li><a href="#">保存PDF</a></li>
	                                    <li><a href="#">导出EXCEL</a></li>
	                                    <li><a href="#">导出CSV</a></li>
	                                </ul>
	                            </div>
	                            <shiro:hasPermission name="institution:add">
	                            <span id="add" class="btn increase pull-right col-sm-4" >新增 <i
	                                    class="fa  fa-plus-square-o right"></i></span>
	                        	</shiro:hasPermission>
	                        </div>
	                    </div>
                            
                            <div class="dataTables_wrapper form-inline no-footer">
                                <table id="myTable" class="table table-striped table-hover table-bordered dataTable no-footer margin-top-10">
                                    <thead>
	                                    <tr role="row">
	                                        <th width="5%">
	                                            <label>
	                                                <input type="checkbox" class="master">
	                                                <span class="text"></span>
	                                            </label>
	                                        </th>
	                                        <th>发布部门</th>
	                                        <th>标题</th>
	                                        <th>发布日期</th>
	                                        <th>修改日期</th>
	                                        <th>发布人</th>
	                                        <th>状态</th>
	                                        <th>操作</th>
	                                    </tr>
                                    </thead>

                                    <!-- <tbody>
                                    <tr class="odd">
                                        <td width="5%">
                                            <label>
                                                <input type="checkbox">
                                                <span class="text"></span>
                                            </label>
                                        </td>
                                        <td class="">质检中心</td>
                                        <td class=" ">咨询规则</td>
                                        <td class=" ">2016-10-29</td>
                                        <td class=""></td>
                                        <td class=" ">王大伟</td>
                                        <td class="">生效</td>
                                        <td class=" ">
                                            <a href="#" class="btn btn-warning btn-xs edit" data-toggle="modal" data-target=".bs-example-modal-sm"><i class="fa fa-folder-open-o"></i> 查看</a>
                                            <a href="#" class="btn btn-info btn-xs edit"
                                               data-toggle="modal" data-target=".bs-example-modal-lg"><i
                                                    class="fa fa-edit"></i> 编辑</a>
                                            <a href="#" class="btn btn-danger btn-xs delete">
                                                <i class="fa fa-trash-o"></i> 废除</a>
                                        </td>
                                    </tr>
                                    <tr class="even">
                                        <td width="5%">
                                            <label>
                                                <input type="checkbox">
                                                <span class="text"></span>
                                            </label>
                                        </td>
                                        <td class="">质检中心</td>
                                        <td class=" ">咨询规则</td>
                                        <td class=" ">2016-10-29</td>
                                        <td class=""></td>
                                        <td class=" ">王大伟</td>
                                        <td class="">废除</td>
                                        <td class=" ">
                                            <a href="#" class="btn btn-warning btn-xs"
                                               data-toggle="modal" data-target=".bs-example-modal-sm"><i
                                                    class="fa fa-folder-open-o"></i> 查看</a>
                                            <a href="#" class="btn btn-info btn-xs edit"
                                               data-toggle="modal" data-target=".bs-example-modal-lg">
                                                <i class="fa fa-edit"></i> 编辑</a>
                                            <a href="#" class="btn btn-use btn-xs delete"><i
                                                    class="fa fa-check-square-o"></i> 生效</a>
                                        </td>
                                    </tr>
                                    </tbody>  -->
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--编辑-->
<div class="modal fade bs-example-modal-lg" id="myModel" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header bordered-blue">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <span class="widget-caption">编辑规则信息</span>
            </div>
            <div class="modal-body  form-horizontal">
            
            <form id="addForm" class="form-horizontal" onsubmit="return addOrUpdateRecord();">
            	<input type="hidden" name="institutionId"/>
                <div class="form-group">
	                <label class="col-sm-2 control-label no-padding-right">公司
						<span class="control-label mandatory">*</span>
					</label>
	                 <div class="col-sm-9">
	                	<input readonly onclick="showMenu('company_id', 1)" id="company_id" name="company_id" class="form-control"></input>
	                    <input hidden id="companyId" name="companyId" ></input>
	                 </div>
                </div>
                
                <div class="form-group">
                	<label class="col-sm-2 control-label no-padding-right">部门
						<span class="control-label mandatory">*</span>
					</label>
	                 <div class="col-sm-9">
	                	<input readonly onclick="showMenu('department_id', 2)" id="department_id" name="department_id" class="form-control"></input>
	                    <input hidden id="departmentId" name="sysDepartment.departmentId" ></input>
	                 </div>
                </div>

                <div class="form-group">
                    <label class=" col-sm-2 control-label no-padding-right no-padding-left">制度标题
						<span class="control-label mandatory">*</span>
					</label>
                    <div class="col-sm-9">
                        <input type="text" name="institutionName" class="form-control">
                    </div>
                </div>

                <div class="form-group">
                    <label class=" col-sm-2 control-label no-padding-right">内容
						<span class="control-label mandatory">*</span>
					</label>
                    <div class="col-sm-9">
                        
                           <!-- 富文本编辑器 -->
						  <textarea name="institutionDesc" style="width:720px;height:400px;visibility:hidden;"></textarea>
                          
                          <script>
							$.getScript('${ctx_static }/dep/kindeditor-4.1.7/kindeditor-min.js', function() {
								KindEditor.basePath = '${ctx_static }/dep/kindeditor-4.1.7/';
								editor = KindEditor.create('textarea[name="institutionDesc"]',{
									uploadJson:'${ctx }/file/uploadFile',
									resizeType:0
								});
							});
                          </script>                           
                           
                    </div>
                </div>

                <div class="form-group col-sm-12">
                    <div class="col-sm-3 col-sm-offset-4">
                    	<input type="submit" class="btn btn-primary btn-lg col-sm-6" value="确认"/>
                    </div>
                    <div class="col-sm-3 ">
                        <a type="button" href="javascript:$('#myModel').modal('hide')" class="btn btn-danger btn-lg col-sm-6">取消</a>
                    </div>
                </div>
				
				</form>
				
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>

<div id="content" class="menuContent" style="display:none; position: absolute;overflow:auto;z-index: 999999">
	<ul id="ajaxTree" class="ztree" style="margin-top:0; width:168px;height: 100%"></ul>
</div>

<!--查看-->
<div  id="checkModal" class="modal fade bs-example-modal-sm col-lg-12">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header bordered-blue">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <span class="widget-caption">查看</span>
            </div>
            <div class="modal-body">
                <%-- <div class="form-group clearfix">
                    <div class="col-sm-4 col-sm-offset-1">
                        <div class="img">
                            <img src="${ctx_static }/dep/assets/img/attach-blue.png">
                        </div>
                    </div>
                    <div class="col-sm-6 col-sm-offset-1">
                        <p>规则一：关于制用制度规则内容一</p>
                        <p>规则一：关于制用制度规则内容一</p>
                        <p>规则一：关于制用制度规则内容一</p>
                        <p>规则一：关于制用制度规则内容一</p>
                        <p>规则一：关于制用制度规则内容一</p>
                        <p>规则一：关于制用制度规则内容一</p>
                    </div>
                </div>
                <div class="form-group clearfix xian">
                    <div class="col-sm-10 col-sm-offset-1" style="border-top:1px solid #f00;"></div>
                </div>
                <div class="form-group clearfix">
                    <div class="col-sm-10 col-sm-offset-1">
                        <span class="tips">备注：</span><span>关于制用制度规则内容一关于制用制度规则内容一关于制用制度规则内容一关于制用制度规则内容一关于制用制度规则内容一关于制用制度规则内容一关于制用制度规则内容一关于制用制度规则内容一</span>
                    </div>
                </div> --%>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>

<script>
//table初始化
var InitiateSimpleDataTable = function () {
    return {
        init: function () {
            //Datatable Initiating
            var oTable = $('#myTable').dataTable({
            	"bPaginate": true,  //是否显示分页
            	"iDisplayLength": 10,
            	"bLengthChange": false,//每页显示的记录数
            	"bFilter": false, //搜索栏
            	"bSort": true, //是否支持排序功能
            	"bInfo": true, //显示表格信息
            	"bAutoWidth": false,  //自适应宽度
            	"bStateSave": true, //保存状态到cookie *************** 很重要 ， 当搜索的时候页面一刷新会导致搜索的消失。使用这个属性就可避免了
            	//"sPaginationType": "", //分页，一共两种样式，full_numbers和two_button(默认)
            	"sAjaxSource" : ctx+'/institution/getAll',
        		"fnServerData": retrieveData,//用于替换默认发到服务端的请求操作  
            	"bServerSide": true,
            	"bDestroy": true,
                "bRetrieve": false,
            	"oLanguage" : {
        			"sLengthMenu" : "每页显示 _MENU_ 条记录",
        			"sZeroRecords" : "抱歉， 没有找到",
        			"sInfo" : "从 _START_ 到 _END_ / 共 _TOTAL_ 条数据",
        			"sInfoEmpty" : "找不到相关数据",
        			"sInfoFiltered" : "数据表中共为 _MAX_ 条记录)",
        			"sProcessing": "正在加载中...",
        			"sSearch": "搜索",
        			"oPaginate" : {
        				"sFirst" : "首页",
        				"sPrevious" : "前一页",
        				"sNext" : "后一页",
        				"sLast" : "尾页"
        			},
        		},
        		"aoColumns" : [
        		               	{ "mDataProp": "institutionId","bSortable": false,'sClass': "text-center", "mRender":function(data, type, full){
        		               		return "<label> <input type='checkbox' class='slaver'> <span class='text'></span> </label>";
        		               	}},
        		               	{ "mDataProp": "sysDepartment.fullName","bSortable": true,'sClass': "text-center"},
        		               	{ "mDataProp": "institutionName","bSortable": true,'sClass': "text-center"}, 
        		               	{ "mDataProp": "createDate","bSortable": true,'sClass': "text-center"},
        		               	{ "mDataProp": "modifyDate","bSortable": true,'sClass': "text-center"},
        		               	{ "mDataProp": "createUserName","bSortable": true,'sClass': "text-center"},
        		               	{ "mDataProp": "enable","bSortable": true,'sClass': "text-center","mRender":function(data, type, full){
        		               		return data?'生效':'废除';
        		               	}},
        		               	{ "mDataProp": "institutionId","bSortable": false,'sClass': "text-center","mRender":function(data, type, full){
        		               		return '<a href="#" data-id="'+data+'" class="btn btn-warning btn-xs check"><i class="fa fa-folder-open-o"></i> 查看</a>'+
                                    '<shiro:hasPermission name="institution:edit"><a href="#" data-id="'+data+'" class="btn btn-info btn-xs edit"><i class="fa fa-edit"></i> 编辑</a></shiro:hasPermission>'+
                                    '<shiro:hasPermission name="institution:delete"><a href="#" data-id="'+data+'" class="btn btn-danger btn-xs delete"><i class="fa fa-trash-o"></i> 废除</a></shiro:hasPermission>';
        		               	}},
        		   			],
	   			"aoColumnDefs": [{
	   	            sDefaultContent: '',
	   	            aTargets: ['_all']
	   	        }],
            	
            });

        }

    };

}();
</script>
<script src="${ctx_static }/dep/assets/js/jquery.ztree.core-3.5.min.js"></script>
<script src="${ctx_static }/dep/assets/js/jquery.ztree.excheck-3.5.min.js"></script>
<script src="${ctx_static }/home/sysconf/js/zhidu.js"></script> 

